package com.freejava.test_freemarker.controller;

import com.freejava.test_freemarker.pojo.Message;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class KanbanController {
    @GetMapping("/kanban/popular_messages")
    public String showPopularMessages(Model model) {
        Message message = new Message((long) 1314, "重拾良质：禅和摩托车维修技术", 4, "https://mp.weixin.qq.com/s/lFq9ZFQEedv6PyrHPO9EDw");
        Message message2 = new Message((long) 1315, "领导力修炼手册", 1, "首先明白一些基础概念，如下：\n" +
                "影响力：不依赖正式权力而让他人服从你。\n" +
                "领导力：激励和启发员工做好工作，实现目标。\n" +
                "而解决问题的通用型流程：\n" +
                "发现问题。\n" +
                "弄清问题根源。\n" +
                "制定解决问题的解决方案。\n" +
                "选择一个解决方案。");

        List<Message> messageList = new ArrayList<Message>();
        messageList.add(message);
        messageList.add(message2);
        model.addAttribute("messages", messageList);

        return "popular_messages";
    }
}
